package icu.javayanglei.exception;

import icu.javayanglei.enumeration.ResultCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 返回体异常
 *
 * @author yang
 * @version 1.0.0
 * @date 2020-11-22 10:49
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ResultException extends RuntimeException {
    private Integer code;
    private String message;
    private Object data;

    public ResultException(ResultCode resultCode) {
        this.code = resultCode.code();
        this.message = resultCode.message();
    }

    public ResultException(ResultCode resultCode, Object data) {
        this.code = resultCode.code();
        this.message = resultCode.message();
        this.data = data;
    }
}

